import 'package:cbec_app/generated/json/base/json_convert_content.dart';
import 'package:cbec_app/pages/home/Entity/index_page_ad_entity.dart';

IndexPageAdEntity $IndexPageAdEntityFromJson(Map<String, dynamic> json) {
  final IndexPageAdEntity indexPageAdEntity = IndexPageAdEntity();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    indexPageAdEntity.id = id;
  }
  final String? cd = jsonConvert.convert<String>(json['cd']);
  if (cd != null) {
    indexPageAdEntity.cd = cd;
  }
  final String? md = jsonConvert.convert<String>(json['md']);
  if (md != null) {
    indexPageAdEntity.md = md;
  }
  final int? df = jsonConvert.convert<int>(json['df']);
  if (df != null) {
    indexPageAdEntity.df = df;
  }
  final String? cid = jsonConvert.convert<String>(json['cid']);
  if (cid != null) {
    indexPageAdEntity.cid = cid;
  }
  final String? sid = jsonConvert.convert<String>(json['sid']);
  if (sid != null) {
    indexPageAdEntity.sid = sid;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    indexPageAdEntity.status = status;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    indexPageAdEntity.name = name;
  }
  final String? fileUrl = jsonConvert.convert<String>(json['fileUrl']);
  if (fileUrl != null) {
    indexPageAdEntity.fileUrl = fileUrl;
  }
  final int? jumpType = jsonConvert.convert<int>(json['jumpType']);
  if (jumpType != null) {
    indexPageAdEntity.jumpType = jumpType;
  }
  final Map? content = (json['content'] as Map<String, dynamic>?)?.map((k, e) => MapEntry(k, e));
  if (content != null) {
    indexPageAdEntity.content = content;
  }
  final String? startdate = jsonConvert.convert<String>(json['startdate']);
  if (startdate != null) {
    indexPageAdEntity.startdate = startdate;
  }
  final String? enddate = jsonConvert.convert<String>(json['enddate']);
  if (enddate != null) {
    indexPageAdEntity.enddate = enddate;
  }
  final int? mainPage = jsonConvert.convert<int>(json['mainPage']);
  if (mainPage != null) {
    indexPageAdEntity.mainPage = mainPage;
  }
  final int? microPage = jsonConvert.convert<int>(json['microPage']);
  if (microPage != null) {
    indexPageAdEntity.microPage = microPage;
  }
  final int? paySuccessPage = jsonConvert.convert<int>(json['paySuccessPage']);
  if (paySuccessPage != null) {
    indexPageAdEntity.paySuccessPage = paySuccessPage;
  }
  final int? targetType = jsonConvert.convert<int>(json['targetType']);
  if (targetType != null) {
    indexPageAdEntity.targetType = targetType;
  }
  final int? pushType = jsonConvert.convert<int>(json['pushType']);
  if (pushType != null) {
    indexPageAdEntity.pushType = pushType;
  }
  final int? customizeType = jsonConvert.convert<int>(json['customizeType']);
  if (customizeType != null) {
    indexPageAdEntity.customizeType = customizeType;
  }
  final int? customizeValue = jsonConvert.convert<int>(json['customizeValue']);
  if (customizeValue != null) {
    indexPageAdEntity.customizeValue = customizeValue;
  }
  final List<dynamic>? customizeWeek = (json['customizeWeek'] as List<dynamic>?)?.map((e) => e).toList();
  if (customizeWeek != null) {
    indexPageAdEntity.customizeWeek = customizeWeek;
  }
  final int? totalOpen = jsonConvert.convert<int>(json['totalOpen']);
  if (totalOpen != null) {
    indexPageAdEntity.totalOpen = totalOpen;
  }
  final int? pushTotal = jsonConvert.convert<int>(json['pushTotal']);
  if (pushTotal != null) {
    indexPageAdEntity.pushTotal = pushTotal;
  }
  return indexPageAdEntity;
}

Map<String, dynamic> $IndexPageAdEntityToJson(IndexPageAdEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['cd'] = entity.cd;
  data['md'] = entity.md;
  data['df'] = entity.df;
  data['cid'] = entity.cid;
  data['sid'] = entity.sid;
  data['status'] = entity.status;
  data['name'] = entity.name;
  data['fileUrl'] = entity.fileUrl;
  data['jumpType'] = entity.jumpType;
  data['content'] = entity.content;
  data['startdate'] = entity.startdate;
  data['enddate'] = entity.enddate;
  data['mainPage'] = entity.mainPage;
  data['microPage'] = entity.microPage;
  data['paySuccessPage'] = entity.paySuccessPage;
  data['targetType'] = entity.targetType;
  data['pushType'] = entity.pushType;
  data['customizeType'] = entity.customizeType;
  data['customizeValue'] = entity.customizeValue;
  data['customizeWeek'] = entity.customizeWeek;
  data['totalOpen'] = entity.totalOpen;
  data['pushTotal'] = entity.pushTotal;
  return data;
}

extension IndexPageAdEntityExtension on IndexPageAdEntity {
  IndexPageAdEntity copyWith({
    String? id,
    String? cd,
    String? md,
    int? df,
    String? cid,
    String? sid,
    int? status,
    String? name,
    String? fileUrl,
    int? jumpType,
    Map? content,
    String? startdate,
    String? enddate,
    int? mainPage,
    int? microPage,
    int? paySuccessPage,
    int? targetType,
    int? pushType,
    int? customizeType,
    int? customizeValue,
    List<dynamic>? customizeWeek,
    int? totalOpen,
    int? pushTotal,
  }) {
    return IndexPageAdEntity()
      ..id = id ?? this.id
      ..cd = cd ?? this.cd
      ..md = md ?? this.md
      ..df = df ?? this.df
      ..cid = cid ?? this.cid
      ..sid = sid ?? this.sid
      ..status = status ?? this.status
      ..name = name ?? this.name
      ..fileUrl = fileUrl ?? this.fileUrl
      ..jumpType = jumpType ?? this.jumpType
      ..content = content ?? this.content
      ..startdate = startdate ?? this.startdate
      ..enddate = enddate ?? this.enddate
      ..mainPage = mainPage ?? this.mainPage
      ..microPage = microPage ?? this.microPage
      ..paySuccessPage = paySuccessPage ?? this.paySuccessPage
      ..targetType = targetType ?? this.targetType
      ..pushType = pushType ?? this.pushType
      ..customizeType = customizeType ?? this.customizeType
      ..customizeValue = customizeValue ?? this.customizeValue
      ..customizeWeek = customizeWeek ?? this.customizeWeek
      ..totalOpen = totalOpen ?? this.totalOpen
      ..pushTotal = pushTotal ?? this.pushTotal;
  }
}
